<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        *{
            margin: 0px;
            padding: 0px;
        }
        article{
            width: 50%;
            margin: 0 auto;
        }
        article div{
            border: 1px solid red;
            padding: 30px;
        }
        article div:first-child{
            text-align: center;
            background-color: sandybrown;
        }
        article div:last-child{
            height: 500px;
            padding: 0px;
        }
        div li{
            list-style: none;
            height: 500px;
            display: none;
            background:-webkit-linear-gradient(top, red, yellow, blue);
            text-align: center;
            line-height: 500px;
            font-size: 35px;
        }
        button{
            margin: 0px 20px;
            width: 80px;
            height: 30px;
        }
        .buttonShow{
            background-color: purple;
            color:white;
        }
        .liShow{
            display: block;
        }
    </style>
    <script>
        window.onload=function(){
            var btns=document.getElementsByTagName('button');
            var lis=document.getElementsByTagName('li');
            for(var i=0;i<btns.length;i++){
                btns[i].onclick=(function(num){
                    return function(){
                        // console.log(num);
                        //取消所有的默认样式
                        for(var j=0;j<btns.length;j++){
                            btns[j].className='';
                        }
                        //按钮变色
                        this.className='buttonShow'
                        //取消所有的li对应的样式，即让他隐藏
                        for(var k=0;k<lis.length;k++){
                            lis[k].className='';
                        }
                        //button对应的内容切换
                        lis[num].className='liShow';
                    }
                })(i)
            }
        }
    </script>
</head>
<body>
    <article>
        <div>
            <button class="buttonShow">学生管理</button>
            <button>教师管理</button>
            <button>选课管理</button>
            <button>用户管理</button>
        </div>
        <div>
            <ul>
                <li class="liShow">学生管理系统----</li>
                <li>教师管理系统</li>
                <li>选课管理系统</li>
                <li>用户管理系统</li>
            </ul>
        </div>
    </article>
    
</body>
</html>